package com.tc.erp.util;

import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class AppContextUtils  implements ApplicationContextAware{
	protected static final Log log = LogFactory.getLog(AppContextUtils.class);
	private static ApplicationContext ctx;

	public void setApplicationContext(ApplicationContext ctx) {
		AppContextUtils.ctx = ctx;
	}

	public static <T> T getBean(Class<T> clz) {
		return ctx.getBean(clz);
	}

	public static <T> T getBean(String name, Class<T> clz) {
		return ctx.getBean(name, clz);
	}
}
